﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Globalization;
using Google.GData.YouTube;
using Resources;
using System.Threading;
using System.Net.Mail;
using System.Net;
using System.IO;
using Google.GData.Client;
using Google.GData.Photos;
using FlickrNet;

public partial class _Page : System.Web.UI.Page
{
    public string SubSportName { get; set; }
    public string SportName { get; set; }
    public string SearchPhrase
    {
        get
        {
            string result;
            if (!string.IsNullOrEmpty(SportName))
            {
                result = SportName;
                if (!string.IsNullOrEmpty(SportName))
                {
                    result += " " + SubSportName;
                }

            }
            else
            {
                result = "Sport News";
            }
            return result;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            foreach (string key in Request.QueryString)
            {
                switch (key.ToLower())
                {
                    case "sport": this.SportName = Request.QueryString[key]; break;
                    case "discipline": this.SubSportName = Request.QueryString[key]; break;
                }
            }
            MainWebContent.SearchPhrase = SearchPhrase;
        }

        //Set the title
        this.Title = GenerateTitle();
    }

    private string GenerateTitle()
    {
        StringBuilder result = new StringBuilder();
        result.Append(this.SearchPhrase);
        result.Append(" - Latest ");
        Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us");
        result.Append(" News, Pictures And Videos Dated ");
        result.Append(DateTime.Now.ToString("MMMM yyyy"));
        string actualResult = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(result.ToString());
        return actualResult;
    }


    


    
}

